﻿using System;

class PrimeNumberPrinter
{
    static bool IsPrime(int number)
    {
        if (number <= 1) return false;
        if (number == 2) return true; 
        if (number % 2 == 0) return false; 
        for (int i = 3; i <= Math.Sqrt(number); i += 2)
        {
            if (number % i == 0) return false;
        }
        return true;
    }

    static void Main(string[] args)
    {
        Console.Write("输入下限数: ");
        int lowerBound = int.Parse(Console.ReadLine());

        Console.Write("输入上限数: ");
        int upperBound = int.Parse(Console.ReadLine());

        int primeCount = 0;
        int primesPerLine = 10;

        for (int i = lowerBound; i <= upperBound; i++)
        {
            if (IsPrime(i))
            {
                Console.Write($"{i,4}"); 
                primeCount++;

                if (primeCount % primesPerLine == 0)
                {
                    Console.WriteLine(); 
                }
            }
        }

        if (primeCount % primesPerLine != 0)
        {
            Console.WriteLine();
        }
        Console.ReadLine();
    }
}